IF OBJECT_ID('dbo.csp_rptMetric_SnapshotDataThisPeriod') IS NOT NULL
BEGIN
    DROP PROCEDURE dbo.csp_rptMetric_SnapshotDataThisPeriod
END
GO

CREATE PROCEDURE dbo.csp_rptMetric_SnapshotDataThisPeriod
(
	@PeriodType varchar(50)
,	@PeriodStartDate smalldatetime
)
AS

SELECT--changed by aab on 3/24/2009
PeriodType,
PeriodStartDate,
PeriodEndDate,
PeriodDescription,
CONVERT(VARCHAR(12),SnapshotDate,101) as SnapshotDateHeader,
CONVERT(VARCHAR(12),DATEADD(day, -1, SnapshotDate),101) as SnapshotDate,
CONVERT(VARCHAR(12),PeriodStartDate,101) + ' - ' + CONVERT(VARCHAR(12),DATEADD(day, -1, SnapshotDate),101) as PeriodDateRange
FROM	rptMetric_Snapshots
WHERE 1=1
AND	PeriodType = @PeriodType
AND	PeriodStartDate = @PeriodStartDate
GO
